import '../../styles.css'

import Image from "next/image";
import styles from "@/pages/employee_qrcode/index.module.css";
import React, {useEffect, useState} from "react";
import {useRouter} from "next/router";

export default function EmployeeQrcode() {
    const router = useRouter();
    const [qrcode, setQrcode] = useState('');
    const [txt, setTxt] = useState('');

    useEffect(() => {
        const qrcode = router.query.qr
        const txt = router.query.txt
        if (qrcode) {
            setQrcode(qrcode as string)
        }
        if (txt) {
            setTxt(txt as string)
        }

    }, [router.isReady]);

    return (
        <div className={styles.container}>
            <Image className={styles.qrcode_img} src={qrcode} alt={''}/>
            <div className={styles.qrcode_tips}>
                {txt}
            </div>
        </div>
    );
}
